home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1997 October: Mac OS SDK / Dev.CD Oct 97 SDK1.toast / Development Kits (Disc 1) / Interfaces&Libraries / Universal / Interfaces / CIncludes / Dictionary.h < prev    next >
Encoding:
C/C++ Source or Header  |  1997-08-12  |  4.4 KB  |  163 lines  |  [TEXT/MPS ]

  1. /*
  2.      File:        Dictionary.h
  3.  
  4.      Contains:    Dictionary Manager Interfaces
  5.  
  6.      Version:    Technology:    System 7
  7.                  Release:    Universal Interfaces 3.0.1
  8.  
  9.      Copyright:    © 1992-1997 by Apple Computer, Inc., all rights reserved.
  10.  
  11.      Bugs?:        Please include the the file and version information (from above) with
  12.                  the problem description.  Developers belonging to one of the Apple
  13.                  developer programs can submit bug reports to:
  14.  
  15.                      devsupport@apple.com
  16.  
  17. */
  18. #ifndef __DICTIONARY__
  19. #define __DICTIONARY__
  20.  
  21. #ifndef __TYPES__
  22. #include <Types.h>
  23. #endif
  24. #ifndef __FILES__
  25. #include <Files.h>
  26. #endif
  27.  
  28.  
  29.  
  30. #if PRAGMA_ONCE
  31. #pragma once
  32. #endif
  33.  
  34. #ifdef __cplusplus
  35. extern "C" {
  36. #endif
  37.  
  38. #if PRAGMA_IMPORT
  39. #pragma import on
  40. #endif
  41.  
  42. #if PRAGMA_STRUCT_ALIGN
  43.     #pragma options align=mac68k
  44. #elif PRAGMA_STRUCT_PACKPUSH
  45.     #pragma pack(push, 2)
  46. #elif PRAGMA_STRUCT_PACK
  47.     #pragma pack(2)
  48. #endif
  49.  
  50.  
  51. enum {
  52.                                                                 /* Dictionary data insertion modes */
  53.     kInsert                        = 0,                            /* Only insert the input entry if there is nothing in the dictionary that matches the key. */
  54.     kReplace                    = 1,                            /* Only replace the entries which match the key with the input entry. */
  55.     kInsertOrReplace            = 2                                /* Insert the entry if there is nothing in the dictionary which matches the key, otherwise replaces the existing matched entries with the input entry. */
  56. };
  57.  
  58. /* This Was InsertMode */
  59. typedef short                             DictionaryDataInsertMode;
  60.  
  61. enum {
  62.                                                                 /* Key attribute constants */
  63.     kIsCaseSensitive            = 0x10,                            /* case sensitive = 16        */
  64.     kIsNotDiacriticalSensitive    = 0x20                            /* diac not sensitive = 32    */
  65. };
  66.  
  67.  
  68. enum {
  69.                                                                 /* Registered attribute type constants.    */
  70.     kNoun                        = -1,
  71.     kVerb                        = -2,
  72.     kAdjective                    = -3,
  73.     kAdverb                        = -4
  74. };
  75.  
  76. /* This Was AttributeType */
  77. typedef SInt8                             DictionaryEntryAttribute;
  78. /* Dictionary information record */
  79. struct DictionaryInformation {
  80.     FSSpec                             dictionaryFSSpec;
  81.     SInt32                             numberOfRecords;
  82.     SInt32                             currentGarbageSize;
  83.     ScriptCode                         script;
  84.     SInt16                             maximumKeyLength;
  85.     SInt8                             keyAttributes;
  86. };
  87. typedef struct DictionaryInformation DictionaryInformation;
  88.  
  89. struct DictionaryAttributeTable {
  90.     UInt8                             datSize;
  91.     DictionaryEntryAttribute         datTable[1];
  92. };
  93. typedef struct DictionaryAttributeTable DictionaryAttributeTable;
  94.  
  95. typedef DictionaryAttributeTable *        DictionaryAttributeTablePtr;
  96. EXTERN_API( OSErr )
  97. InitializeDictionary            (const FSSpec *            theFsspecPtr,
  98.                                  SInt16                 maximumKeyLength,
  99.                                  SInt8                     keyAttributes,
  100.                                  ScriptCode             script)                                THREEWORDINLINE(0x303C, 0x0500, 0xAA53);
  101.  
  102. EXTERN_API( OSErr )
  103. OpenDictionary                    (const FSSpec *            theFsspecPtr,
  104.                                  SInt8                     accessPermission,
  105.                                  SInt32 *                dictionaryReference)                THREEWORDINLINE(0x303C, 0x0501, 0xAA53);
  106.  
  107. EXTERN_API( OSErr )
  108. CloseDictionary                    (SInt32                 dictionaryReference)                THREEWORDINLINE(0x303C, 0x0202, 0xAA53);
  109.  
  110. EXTERN_API( OSErr )
  111. InsertRecordToDictionary        (SInt32                 dictionaryReference,
  112.                                  ConstStr255Param         key,
  113.                                  Handle                 recordDataHandle,
  114.                                  DictionaryDataInsertMode  whichMode)                        THREEWORDINLINE(0x303C, 0x0703, 0xAA53);
  115.  
  116. EXTERN_API( OSErr )
  117. DeleteRecordFromDictionary        (SInt32                 dictionaryReference,
  118.                                  ConstStr255Param         key)                                THREEWORDINLINE(0x303C, 0x0404, 0xAA53);
  119.  
  120. EXTERN_API( OSErr )
  121. FindRecordInDictionary            (SInt32                 dictionaryReference,
  122.                                  ConstStr255Param         key,
  123.                                  DictionaryAttributeTablePtr  requestedAttributeTablePointer,
  124.                                  Handle                 recordDataHandle)                    THREEWORDINLINE(0x303C, 0x0805, 0xAA53);
  125.  
  126. EXTERN_API( OSErr )
  127. FindRecordByIndexInDictionary    (SInt32                 dictionaryReference,
  128.                                  SInt32                 recordIndex,
  129.                                  DictionaryAttributeTablePtr  requestedAttributeTablePointer,
  130.                                  Str255                 recordKey,
  131.                                  Handle                 recordDataHandle)                    THREEWORDINLINE(0x303C, 0x0A06, 0xAA53);
  132.  
  133. EXTERN_API( OSErr )
  134. GetDictionaryInformation        (SInt32                 dictionaryReference,
  135.                                  DictionaryInformation * theDictionaryInformation)            THREEWORDINLINE(0x303C, 0x0407, 0xAA53);
  136.  
  137. EXTERN_API( OSErr )
  138. CompactDictionary                (SInt32                 dictionaryReference)                THREEWORDINLINE(0x303C, 0x0208, 0xAA53);
  139.  
  140.  
  141.  
  142.  
  143. #if PRAGMA_STRUCT_ALIGN
  144.     #pragma options align=reset
  145. #elif PRAGMA_STRUCT_PACKPUSH
  146.     #pragma pack(pop)
  147. #elif PRAGMA_STRUCT_PACK
  148.     #pragma pack()
  149. #endif
  150.  
  151. #ifdef PRAGMA_IMPORT_OFF
  152. #pragma import off
  153. #elif PRAGMA_IMPORT
  154. #pragma import reset
  155. #endif
  156.  
  157. #ifdef __cplusplus
  158. }
  159. #endif
  160.  
  161. #endif /* __DICTIONARY__ */
  162.  
  163.